<?php

namespace common\models\datas;

use Yii;

/**
 * This is the model class for table "{{%balance_relation}}".
 *
 * @property integer $balance_id
 * @property integer $relation_id
 * @property integer $type
 */
class BalanceRelation extends \common\components\bases\BaseModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%balance_relation}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['balance_id', 'relation_id','type'], 'required'],
            [['balance_id', 'relation_id','type'], 'integer']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'balance_id' => Yii::t('common', 'Balance ID'),
            'relation_id' => Yii::t('common', 'Relation_id ID'),
            'type' => Yii::t('common', '类型'),
        ];
    }

    public function getBalance()
    {
        return $this->hasOne(Balance::className(), ['balance_id' => 'balance_id']);
    }
}
